home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow / BaseClasses / fourcc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  2.0 KB  |  101 lines

  1. //------------------------------------------------------------------------------
  2. // File: FourCC.h
  3. //
  4. // Desc: DirectShow base classes.
  5. //
  6. // Copyright (c) 1992-2001 Microsoft Corporation.  All rights reserved.
  7. //------------------------------------------------------------------------------
  8.  
  9.  
  10. // FOURCCMap
  11. //
  12. // provides a mapping between old-style multimedia format DWORDs
  13. // and new-style GUIDs.
  14. //
  15. // A range of 4 billion GUIDs has been allocated to ensure that this
  16. // mapping can be done straightforwardly one-to-one in both directions.
  17. //
  18. // January 95
  19.  
  20.  
  21. #ifndef __FOURCC__
  22. #define __FOURCC__
  23.  
  24.  
  25. // Multimedia format types are marked with DWORDs built from four 8-bit
  26. // chars and known as FOURCCs. New multimedia AM_MEDIA_TYPE definitions include
  27. // a subtype GUID. In order to simplify the mapping, GUIDs in the range:
  28. //    XXXXXXXX-0000-0010-8000-00AA00389B71
  29. // are reserved for FOURCCs.
  30.  
  31. class FOURCCMap : public GUID
  32. {
  33.  
  34. public:
  35.     FOURCCMap();
  36.     FOURCCMap(DWORD Fourcc);
  37.     FOURCCMap(const GUID *);
  38.  
  39.     DWORD GetFOURCC(void);
  40.     void SetFOURCC(DWORD fourcc);
  41.     void SetFOURCC(const GUID *);
  42.  
  43. private:
  44.     void InitGUID();
  45. };
  46.  
  47. #define GUID_Data2      0
  48. #define GUID_Data3     0x10
  49. #define GUID_Data4_1   0xaa000080
  50. #define GUID_Data4_2   0x719b3800
  51.  
  52. inline void
  53. FOURCCMap::InitGUID() {
  54.     Data2 = GUID_Data2;
  55.     Data3 = GUID_Data3;
  56.     ((DWORD *)Data4)[0] = GUID_Data4_1;
  57.     ((DWORD *)Data4)[1] = GUID_Data4_2;
  58. }
  59.  
  60. inline
  61. FOURCCMap::FOURCCMap() {
  62.     InitGUID();
  63.     SetFOURCC( DWORD(0));
  64. }
  65.  
  66. inline
  67. FOURCCMap::FOURCCMap(DWORD fourcc)
  68. {
  69.     InitGUID();
  70.     SetFOURCC(fourcc);
  71. }
  72.  
  73. inline
  74. FOURCCMap::FOURCCMap(const GUID * pGuid)
  75. {
  76.     InitGUID();
  77.     SetFOURCC(pGuid);
  78. }
  79.  
  80. inline void
  81. FOURCCMap::SetFOURCC(const GUID * pGuid)
  82. {
  83.     FOURCCMap * p = (FOURCCMap*) pGuid;
  84.     SetFOURCC(p->GetFOURCC());
  85. }
  86.  
  87. inline void
  88. FOURCCMap::SetFOURCC(DWORD fourcc)
  89. {
  90.     Data1 = fourcc;
  91. }
  92.  
  93. inline DWORD
  94. FOURCCMap::GetFOURCC(void)
  95. {
  96.     return Data1;
  97. }
  98.  
  99. #endif /* __FOURCC__ */
  100.  
  101.